
//reducer 实际上就一个函数
//state: 之前的状态   action：对数据的操作

function counter_reducer(state={value:100},action){
    switch(action.type){
        case 'add':
               console.log("action.payload",action.payload)
               console.log(state.value+ parseInt(action.payload.num))
        return {value: state.value+ parseInt(action.payload.num)}
        default :return  state
    }
}

export default  counter_reducer